package com.maxjay.component.simplelist.service.impl;

import org.springframework.stereotype.Service;

@Service("paginationServiceJdbcOracle")
public class PaginationServiceJdbcOracle extends PaginationServiceJdbc {
	
	protected String generatePaginationSql(String sql, int startRow, int endRow){
		if (startRow < 0 || endRow < 0) {
			return sql;
		}
		String paginationSql = "SELECT * FROM (select row_.*, ROWNUM rownum_ FROM ("
			+ sql
			+ ") row_) WHERE rownum_ >"
			+ startRow
			+ " AND rownum_ <=" + endRow;
		return paginationSql;
	}
	
}
